package ru.spbau.database.group3.engine;

import ru.spbau.database.group3.types.Type;

import java.io.Serializable;

/**
 * @author: stas
 * @date: 2/4/13
 * @time: 2:40 PM
 */
public class Column implements Serializable{
    public Column(String name, int offset, Type type) {
        this.name = name;
        this.offset = offset;
        this.type = type;
    }

    public int getOffset() {
        return offset;
    }

    public Type getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    private String name;
    private int offset;
    private Type type;
	
    @Override
    public boolean equals(Object o) {
    	if (o instanceof Column) {
    		Column arg = (Column) o;
    		return name.equals(arg.name) && type.getTypeEnum().equals(arg.type.getTypeEnum());// && offset == arg.offset;
    	} else {
    		return false;
    	}
    }
    
    @Override
    public int hashCode() {
    	return name.hashCode();
    }
}
